﻿using System;
using Castle.Windsor;
using Castle.Windsor.Configuration.Interpreters;

namespace FizzBuzz
{
    public interface ICommerceService
    {
        double GetPrice(string item);
    }

    public class CommerceService : ICommerceService
    {
        public double GetPrice(string item)
        {
            return 99.9;
        }
    }

    public class MockCommerceService : ICommerceService
    {
        public double GetPrice(string item)
        {
            return 9.99;
        }
    }

    /// <summary>
    /// Components wired in the app.config file
    /// </summary>
    public class WindsorTest
    {
        public void Run()
        {
//            WindsorContainer container = new WindsorContainer(new XmlInterpreter());
//            ICommerceService service = container.Resolve<ICommerceService>("mockCommerceService");
//
//            Console.WriteLine("Mock return:{0}", service.GetPrice("item"));
//
//            ICommerceService service2 = container.Resolve<ICommerceService>("liveCommerceService");
//
//            Console.WriteLine("Actual return:{0}", service2.GetPrice("item"));
        }
    }
}